home *** CD-ROM | disk | FTP | other *** search
/ Gamers Delight 2 / Gamers Delight 2.iso / Aminet / game / gag / Accel.lha / Accel.mod < prev    next >
Text File  |  1994-10-07  |  20KB  |  666 lines

  1. MODULE Accel;
  2.  
  3. (*
  4.  *  Source generated with GadToolsBox V2.0
  5.  *  which is (c) Copyright 1991-1993 Jaba Development
  6.  *  Oberon-Sourcecode-Generator by Kai Bolay (AMOK)
  7.  *
  8.  *  GUI Designed by : HDS
  9.  *)
  10.  
  11. IMPORT e:Exec,
  12.        es:ExecSupport,
  13.        cx:Commodities,
  14.        io,
  15.        y:SYSTEM,
  16.        d:Dos,
  17.        wb:Workbench,
  18.        ol:OberonLib,
  19.        conv:Conversions,
  20.        I: Intuition,
  21.        gt: GadTools,
  22.        g: Graphics,
  23.        u: Utility,
  24.        rq: Requests,
  25.        fr: FileReq,
  26.        ic:Icon;
  27.  
  28.  
  29. CONST
  30.   GDMathAccel                       * = 0;
  31.   GDGraphEmu                        * = 1;
  32.   GDMathEn                          * = 2;
  33.   GDGraphAccel                      * = 3;
  34.   GDFPUType                         * = 4;
  35.   GDGraphEn                         * = 5;
  36.   GDSave                            * = 6;
  37.   GDCancel                          * = 7;
  38.   GDUse                             * = 8;
  39.  
  40. CONST
  41.   WinCNT = 9;
  42.   WinLeft = 16;
  43.   WinTop = 31;
  44.   WinWidth = 486;
  45.   WinHeight = 127;
  46. VAR
  47.   Scr*: I.ScreenPtr;
  48.   VisualInfo*: e.APTR;
  49.   WinWnd*: I.WindowPtr;
  50.   WinGList*: I.GadgetPtr;
  51.   WinMenus*: I.MenuPtr;
  52.   WinGadgets*: ARRAY WinCNT OF I.GadgetPtr;
  53.  
  54. TYPE
  55.   GraphEmu0LArray = ARRAY     11 OF e.STRPTR;
  56. CONST
  57.   GraphEmu0Labels = GraphEmu0LArray (
  58.     y.ADR ("Original (OCS)"),
  59.     y.ADR ("Enhanced (ECS)"),
  60.     y.ADR ("Advanced (AGA)"),
  61.     y.ADR ("Retina Z2"),
  62.     y.ADR ("Retina Z3"),
  63.     y.ADR ("Picasso"),
  64.     y.ADR ("Merlin"),
  65.     y.ADR ("OpalVison"),
  66.     y.ADR ("Video7 Mirage VL"),
  67.     y.ADR ("EGS 24Bit"),
  68.     NIL );
  69.  
  70. TYPE
  71.   FPUType0LArray = ARRAY     6 OF e.STRPTR;
  72. CONST
  73.   FPUType0Labels = FPUType0LArray (
  74.     y.ADR ("No FPU"),
  75.     y.ADR ("68881 FPU"),
  76.     y.ADR ("68882 FPU"),
  77.     y.ADR ("68040 FPU"),
  78.     y.ADR ("68060 FPU"),
  79.     NIL );
  80.  
  81. VAR
  82. CONST
  83.   topaz8 = g.TextAttr (y.ADR ("topaz.font"), 8, y.VAL (SHORTSET, 000H), y.VAL (SHORTSET, 001H) );
  84.  
  85. VAR
  86.   WinIText: ARRAY 1 OF I.IntuiText;
  87. TYPE
  88.   WinMArray = ARRAY    11 OF gt.NewMenu;
  89. CONST
  90.   WinNewMenu = WinMArray (
  91.     gt.title, y.ADR ("Project"), NIL, {}, y.VAL (LONGSET, 0), NIL,
  92.     gt.item, y.ADR ("Load Config..."), y.ADR ("L"), {}, y.VAL (LONGSET, 0), NIL,
  93.     gt.item, y.ADR ("Save Config..."), y.ADR ("S"), {}, y.VAL (LONGSET, 0), NIL,
  94.     gt.item, gt.barLabel, NIL, {}, LONGSET {}, NIL,
  95.     gt.item, y.ADR ("About"), NIL, {}, y.VAL (LONGSET, 0), NIL,
  96.     gt.item, gt.barLabel, NIL, {}, LONGSET {}, NIL,
  97.     gt.item, y.ADR ("Hide"), y.ADR ("H"), {}, y.VAL (LONGSET, 0), NIL,
  98.     gt.item, y.ADR ("Quit"), y.ADR ("Q"), {}, y.VAL (LONGSET, 0), NIL,
  99.     gt.title, y.ADR ("Edit"), NIL, {}, y.VAL (LONGSET, 0), NIL,
  100.     gt.item, y.ADR ("Reset To Defaults"), y.ADR ("D"), {}, y.VAL (LONGSET, 0), NIL,
  101.     gt.end, NIL, NIL, {}, LONGSET {}, NIL);
  102. TYPE
  103.   WinGTypesArray = ARRAY WinCNT OF INTEGER;
  104. CONST
  105.   WinGTypes = WinGTypesArray (
  106.     gt.sliderKind,
  107.     gt.cycleKind,
  108.     gt.checkBoxKind,
  109.     gt.sliderKind,
  110.     gt.cycleKind,
  111.     gt.checkBoxKind,
  112.     gt.buttonKind,
  113.     gt.buttonKind,
  114.     gt.buttonKind
  115.   );
  116.  
  117. TYPE
  118.   WinNGadArray = ARRAY WinCNT OF gt.NewGadget;
  119. CONST
  120.   WinNGad = WinNGadArray (
  121.     22, 55, 161, 13, NIL, NIL, GDMathAccel, LONGSET {} ,NIL, NIL,
  122.     256, 72, 161, 13, NIL, NIL, GDGraphEmu, LONGSET {} ,NIL, NIL,
  123.     22, 40, 26, 11, y.ADR ("_Math Acceleration"), NIL, GDMathEn, LONGSET {gt.placeTextRight} ,NIL, NIL,
  124.     256, 55, 161, 13, NIL, NIL, GDGraphAccel, LONGSET {} ,NIL, NIL,
  125.     22, 72, 161, 13, NIL, NIL, GDFPUType, LONGSET {} ,NIL, NIL,
  126.     256, 40, 26, 11, y.ADR ("_Graph Acceleration"), NIL, GDGraphEn, LONGSET {gt.placeTextRight} ,NIL, NIL,
  127.     16, 103, 105, 16, y.ADR ("_Save"), NIL, GDSave, LONGSET {gt.placeTextIn} ,NIL, NIL,
  128.     366, 103, 105, 16, y.ADR ("_Cancel"), NIL, GDCancel, LONGSET {gt.placeTextIn} ,NIL, NIL,
  129.     189, 103, 105, 16, y.ADR ("_Use"), NIL, GDUse, LONGSET {gt.placeTextIn} ,NIL, NIL
  130.   );
  131.  
  132. TYPE
  133.   WinGTagsArray = ARRAY    51 OF u.Tag;
  134. CONST
  135.   WinGTags = WinGTagsArray (
  136.     gt.slMax, 800, gt.slMaxLevelLen, 5, gt.slLevelFormat, y.ADR ("%ld%%"), gt.slLevelPlace, LONGSET {gt.placeTextRight}, I.pgaFreedom, I.lorientHoriz, I.gaRelVerify, I.LTRUE, u.done,
  137.     gt.cyLabels, y.ADR (GraphEmu0Labels[0]), u.done,
  138.     gt.cbChecked, I.LTRUE, gt.underscore, ORD ('_'), u.done,
  139.     gt.slMax, 500, gt.slMaxLevelLen, 5, gt.slLevelFormat, y.ADR ("%ld%%"), gt.slLevelPlace, LONGSET {gt.placeTextRight}, I.pgaFreedom, I.lorientHoriz, I.gaRelVerify, I.LTRUE, u.done,
  140.     gt.cyLabels, y.ADR (FPUType0Labels[0]), u.done,
  141.     gt.cbChecked, I.LTRUE, gt.underscore, ORD ('_'), u.done,
  142.     gt.underscore, ORD ('_'), u.done,
  143.     gt.underscore, ORD ('_'), u.done,
  144.     gt.underscore, ORD ('_'), u.done
  145.   );
  146.  
  147. PROCEDURE SetupScreen* (): INTEGER;
  148. BEGIN
  149.   Scr := I.LockPubScreen (NIL);  IF Scr = NIL THEN RETURN 1 END;
  150.  
  151.   VisualInfo := gt.GetVisualInfo (Scr, u.done);
  152.   IF VisualInfo = NIL THEN RETURN 2 END;
  153.  
  154.   RETURN 0;
  155. END SetupScreen;
  156.  
  157. PROCEDURE CloseDownScreen*;
  158. BEGIN
  159.   IF VisualInfo # NIL THEN
  160.     gt.FreeVisualInfo (VisualInfo);
  161.     VisualInfo := NIL;
  162.   END;
  163.   IF Scr # NIL THEN
  164.     I.UnlockPubScreen (NIL, Scr);
  165.     Scr := NIL;
  166.   END;
  167. END CloseDownScreen;
  168.  
  169. PROCEDURE WinRender*;
  170. VAR
  171.   offx, offy: INTEGER;
  172. BEGIN
  173.   offx := WinWnd^.borderLeft;
  174.   offy := WinWnd^.borderTop;
  175.  
  176.   WinIText[0] := I.IntuiText (1, 0, g.jam1+SHORTSET {}, 143, 13, y.ADR (topaz8), y.ADR ("Amiga Software Accelerator"), NIL);
  177.   WinIText[0].nextText := NIL;
  178.  
  179.   I.PrintIText (WinWnd^.rPort, WinIText[0], offx, offy);
  180.  
  181.   gt.DrawBevelBox (WinWnd^.rPort, offx + 16, offy + 8, 454, 17, gt.visualInfo, VisualInfo, u.done);
  182.   gt.DrawBevelBox (WinWnd^.rPort, offx + 249, offy + 32, 222, 62, gt.visualInfo, VisualInfo, gt.bbRecessed, I.LTRUE, u.done);
  183.   gt.DrawBevelBox (WinWnd^.rPort, offx + 15, offy + 32, 222, 62, gt.visualInfo, VisualInfo, gt.bbRecessed, I.LTRUE, u.done);
  184. END WinRender;
  185.  
  186. PROCEDURE OpenWinWindow* (): INTEGER;
  187. TYPE
  188.   TagArrayPtr = UNTRACED POINTER TO ARRAY MAX (INTEGER) OF u.TagItem;
  189. VAR
  190.   ng: gt.NewGadget;
  191.   gad: I.GadgetPtr;
  192.   help: TagArrayPtr;
  193.   lc, tc, lvc, offx, offy: INTEGER;
  194. BEGIN
  195.   offx := Scr^.wBorLeft; offy := Scr^.wBorTop + Scr^.rastPort.txHeight + 1;
  196.  
  197.   gad := gt.CreateContext (WinGList);
  198.   IF gad = NIL THEN RETURN 1 END;
  199.  
  200.   lc := 0; tc := 0; lvc := 0;
  201.   WHILE lc < WinCNT DO
  202.     ng := WinNGad[lc];
  203.     ng.visualInfo := VisualInfo;
  204.     ng.textAttr   := y.ADR (topaz8);
  205.     INC (ng.leftEdge, offx);
  206.     INC (ng.topEdge, offy);
  207.     help := u.CloneTagItems (y.VAL (TagArrayPtr, y.ADR (WinGTags[tc]))^);
  208.     IF help = NIL THEN RETURN 8 END;
  209.     gad := gt.CreateGadgetA (WinGTypes[lc], gad, ng, help^ );
  210.     u.FreeTagItems (help^);
  211.     IF gad = NIL THEN RETURN 2 END;
  212.     WinGadgets[lc] := gad;
  213.  
  214.     WHILE WinGTags[tc] # u.done DO INC (tc, 2) END;
  215.     INC (tc);
  216.  
  217.     INC (lc);
  218.   END; (* WHILE *)
  219.   WinMenus := gt.CreateMenus (WinNewMenu, gt.mnFrontPen, 0, u.done);
  220.   IF WinMenus = NIL THEN RETURN 3 END;
  221.  
  222.   IF NOT gt.LayoutMenus (WinMenus, VisualInfo, gt.mnTextAttr, y.ADR (topaz8), u.done) THEN RETURN 4 END;
  223.  
  224.   WinWnd := I.OpenWindowTagsA ( NIL,
  225.                     I.waLeft,          WinLeft,
  226.                     I.waTop,           WinTop,
  227.                     I.waInnerWidth,    WinWidth,
  228.                     I.waInnerHeight,   WinHeight,
  229.                     I.waIDCMP,         gt.sliderIDCMP+gt.cycleIDCMP+gt.checkBoxIDCMP+gt.buttonIDCMP+LONGSET {I.menuPick,I.closeWindow,I.refreshWindow},
  230.                     I.waFlags,         LONGSET {I.activate,I.windowDrag,I.windowDepth,I.windowClose},
  231.                     I.waGadgets,       WinGList,
  232.                     I.waTitle,         y.ADR ("Accelerator 1.27"),
  233.                     I.waScreenTitle,   y.ADR ("Workbench Screen"),
  234.                     I.waPubScreen,     Scr,
  235.                     u.done);
  236.   IF WinWnd = NIL THEN RETURN 20 END;
  237.  
  238.   IF NOT I.SetMenuStrip (WinWnd, WinMenus^) THEN RETURN 5 END;
  239.   gt.RefreshWindow (WinWnd, NIL);
  240.  
  241.   WinRender;
  242.  
  243.   RETURN 0;
  244. END OpenWinWindow;
  245.  
  246. PROCEDURE CloseWinWindow*;
  247. BEGIN
  248.   IF WinMenus # NIL THEN
  249.     IF WinWnd # NIL THEN
  250.       I.ClearMenuStrip (WinWnd);
  251.     END;
  252.     gt.FreeMenus (WinMenus);
  253.     WinMenus := NIL;
  254.   END;
  255.   IF WinWnd # NIL THEN
  256.     I.CloseWindow (WinWnd);
  257.     WinWnd := NIL;
  258.   END;
  259.   IF WinGList # NIL THEN
  260.     gt.FreeGadgets (WinGList);
  261.     WinGList := NIL;
  262.   END;
  263. END CloseWinWindow;
  264.  
  265. VAR n:INTEGER;
  266.     ms:I.IntuiMessagePtr;
  267.     Quit,bol,WinOp:BOOLEAN;
  268.     Math,Graph:BOOLEAN;
  269.     MFac,GFac:LONGINT;
  270.     MEmu,GEmu:LONGINT;
  271.     oMath,oGraph:BOOLEAN;
  272.     oMFac,oGFac:LONGINT;
  273.     oMEmu,oGEmu:LONGINT;
  274.     FilNam:ARRAY 120 OF CHAR;
  275.     Gadg:I.GadgetPtr;
  276.     PrSp:I.PropInfoPtr;
  277.  
  278. VAR
  279.      PopKey:ARRAY 100 OF CHAR;
  280.      MyBrk :cx.CxObjPtr;
  281.      MyFil :cx.CxObjPtr;
  282.      MySnd :cx.CxObjPtr;
  283.      MyTrs :cx.CxObjPtr;
  284.      NwBrk :cx.NewBroker;
  285.      MsPrt :e.MsgPortPtr;
  286.      Err   :LONGINT;
  287.      eMsg  :e.APTR;
  288.      Msg   :cx.CxMsgPtr;
  289.      MsTp  :LONGSET;
  290.      MsId  :LONGINT;
  291.      CxPri :LONGINT;
  292.      CxKey :ARRAY 100 OF CHAR;
  293.      CxPop :BOOLEAN;
  294.      Signal:LONGSET;
  295.  
  296. PROCEDURE GetToolTypes;
  297. VAR This:d.ProcessPtr;
  298.     wbm:wb.WBStartupPtr;
  299.     sptr:e.STRPTR;
  300.     MyIcon:wb.DiskObjectPtr;
  301.     OCurrentDir:d.FileLockPtr;
  302. BEGIN;
  303. This:=y.VAL(d.ProcessPtr,ol.Me);
  304. CxPri:=0;CxKey:="alt control a";
  305. CxPop:=TRUE;
  306. IF ol.wbStarted THEN
  307.  wbm:=ol.wbenchMsg;
  308.  OCurrentDir:=This.currentDir;
  309.  y.SETREG(0,d.CurrentDir(wbm.argList[0].lock));
  310.  MyIcon := ic.GetDiskObject(wbm.argList[0].name^);
  311.  y.SETREG(0,d.CurrentDir(OCurrentDir));
  312.  IF MyIcon#NIL THEN
  313.   sptr := ic.FindToolType(MyIcon.toolTypes,"CX_PRIORITY");
  314.   IF sptr#NIL THEN IF conv.StringToInt(sptr^,CxPri) THEN END;END;
  315.   sptr := ic.FindToolType(MyIcon.toolTypes,"CX_POPKEY");
  316.   IF sptr#NIL THEN COPY(sptr^,CxKey);END;
  317.   sptr := ic.FindToolType(MyIcon.toolTypes,"CX_POPUP");
  318.   IF sptr#NIL THEN
  319.    IF (sptr^="NO")OR(sptr^="no")OR(sptr^="No")OR(sptr^="nO")
  320.    THEN CxPop:=FALSE;END;END;
  321.   ic.FreeDiskObject(MyIcon);
  322.  END;
  323. END;
  324. END GetToolTypes;
  325.  
  326. PROCEDURE Refresh(cyc:BOOLEAN);
  327. BEGIN;
  328. IF WinOp THEN
  329.   gt.SetGadgetAttrs(WinGadgets[GDMathEn]^,WinWnd,NIL,gt.cbChecked,I.LTRUE);
  330.  IF Math THEN
  331.   gt.SetGadgetAttrs(WinGadgets[GDMathEn]^,WinWnd,NIL,gt.cbChecked,I.LTRUE);
  332.   gt.SetGadgetAttrs(WinGadgets[GDMathAccel]^,WinWnd,NIL,I.gaDisabled,I.LFALSE);
  333.   gt.SetGadgetAttrs(WinGadgets[GDFPUType]^,WinWnd,NIL,I.gaDisabled,I.LFALSE);
  334.  ELSE
  335.   gt.SetGadgetAttrs(WinGadgets[GDMathEn]^,WinWnd,NIL,gt.cbChecked,I.LFALSE);
  336.   gt.SetGadgetAttrs(WinGadgets[GDMathAccel]^,WinWnd,NIL,I.gaDisabled,I.LTRUE);
  337.   gt.SetGadgetAttrs(WinGadgets[GDFPUType]^,WinWnd,NIL,I.gaDisabled,I.LTRUE);
  338.  END;
  339.  IF Graph THEN
  340.   gt.SetGadgetAttrs(WinGadgets[GDGraphEn]^,WinWnd,NIL,gt.cbChecked,I.LTRUE);
  341.   gt.SetGadgetAttrs(WinGadgets[GDGraphAccel]^,WinWnd,NIL,I.gaDisabled,I.LFALSE);
  342.   gt.SetGadgetAttrs(WinGadgets[GDGraphEmu]^,WinWnd,NIL,I.gaDisabled,I.LFALSE);
  343.  ELSE
  344.   gt.SetGadgetAttrs(WinGadgets[GDGraphEn]^,WinWnd,NIL,gt.cbChecked,I.LFALSE);
  345.   gt.SetGadgetAttrs(WinGadgets[GDGraphAccel]^,WinWnd,NIL,I.gaDisabled,I.LTRUE);
  346.   gt.SetGadgetAttrs(WinGadgets[GDGraphEmu]^,WinWnd,NIL,I.gaDisabled,I.LTRUE);
  347.  END;
  348.  gt.SetGadgetAttrs(WinGadgets[GDGraphAccel]^,WinWnd,NIL,gt.slLevel,GFac);
  349.  gt.SetGadgetAttrs(WinGadgets[GDMathAccel]^,WinWnd,NIL,gt.slLevel,MFac);
  350.  IF cyc THEN
  351.   gt.SetGadgetAttrs(WinGadgets[GDFPUType]^,WinWnd,NIL,gt.cyActive,MEmu);
  352.   gt.SetGadgetAttrs(WinGadgets[GDGraphEmu]^,WinWnd,NIL,gt.cyActive,GEmu);
  353.  END;
  354.  gt.RefreshWindow (WinWnd, NIL);
  355. END;
  356. END Refresh;
  357.  
  358. PROCEDURE Show;
  359. BEGIN;
  360. IF ~WinOp THEN
  361. oMath:=Math;oGraph:=Graph;
  362. oMFac:=MFac;oGFac:=GFac;
  363. oMEmu:=MEmu;oGEmu:=GEmu;
  364. n:=SetupScreen();
  365. n:=OpenWinWindow();
  366. Quit:=FALSE;WinOp:=TRUE;
  367. Refresh(TRUE);
  368. END;
  369. END Show;
  370.  
  371. PROCEDURE ReadInt(VAR n:LONGINT);
  372. VAR st:ARRAY 100 OF CHAR;
  373. BEGIN;
  374. io.ReadString(st);
  375. IF conv.StringToInt(st,n) THEN END;
  376. END ReadInt;
  377.  
  378. PROCEDURE LoadCon;
  379. VAR cf,oli,olo:d.FileHandlePtr;
  380.     n:LONGINT;
  381. BEGIN;
  382. Math:=TRUE;Graph:=TRUE;
  383. MEmu:=0;GEmu:=0;
  384. MFac:=100;GFac:=100;
  385. cf:=d.Open(FilNam,d.oldFile);
  386. IF cf#NIL THEN
  387.  oli:=io.in;
  388.  olo:=io.out;
  389.  io.in:=cf;
  390.  io.out:=cf;
  391.  ReadInt(n);IF n=0 THEN Math:=FALSE;ELSE Math:=TRUE;END;
  392.  ReadInt(MEmu);
  393.  ReadInt(MFac);
  394.  ReadInt(n);IF n=0 THEN Graph:=FALSE;ELSE Graph:=TRUE;END;
  395.  ReadInt(GEmu);
  396.  ReadInt(GFac);
  397.  io.in:=oli;
  398.  io.out:=olo;
  399.  IF d.Close(cf) THEN END;
  400. END;
  401. Refresh(TRUE);
  402. END LoadCon;
  403.  
  404. PROCEDURE SaveCon;
  405. VAR cf,oli,olo:d.FileHandlePtr;
  406. BEGIN;
  407. cf:=d.Open(FilNam,d.newFile);
  408. IF cf#NIL THEN
  409.  oli:=io.in;
  410.  olo:=io.out;
  411.  io.in:=cf;
  412.  io.out:=cf;
  413.  io.in:=cf;
  414.  io.out:=cf;
  415.  IF Math THEN io.WriteInt(1,4);ELSE io.WriteInt(0,10);END;
  416.  io.WriteLn;
  417.  io.WriteInt(MEmu,4);
  418.  io.WriteLn;
  419.  io.WriteInt(MFac,4);
  420.  io.WriteLn;
  421.  IF Graph THEN io.WriteInt(1,4);ELSE io.WriteInt(0,10);END;
  422.  io.WriteLn;
  423.  io.WriteInt(GEmu,4);
  424.  io.WriteLn;
  425.  io.WriteInt(GFac,4);
  426.  io.WriteLn;
  427.  io.WriteString("Ok. It´s only a joke...\n");
  428.  io.in:=oli;
  429.  io.out:=olo;
  430.  IF d.Close(cf) THEN END;
  431. END;
  432. END SaveCon;
  433.  
  434. PROCEDURE LoadConR;
  435. BEGIN;
  436. IF fr.FileReq("Select Filename:",FilNam) THEN LoadCon;END;
  437. END LoadConR;
  438.  
  439. PROCEDURE SaveConR;
  440. BEGIN;
  441. IF fr.FileReqSave("Select Filename:",FilNam) THEN SaveCon;END;
  442. END SaveConR;
  443.  
  444. PROCEDURE Hide;
  445. BEGIN;
  446. IF WinOp THEN
  447. WinOp:=FALSE;
  448. CloseWinWindow;
  449. CloseDownScreen;END;
  450. END Hide;
  451.  
  452. PROCEDURE About;
  453. BEGIN;
  454. bol:=rq.RequestWin("Amiga Accelerator V1.27",
  455.       "1994 ADI Inc.\n\n"
  456.       "This is SUCKSware. See the\ndocs for further information.",
  457.       "","Ok",WinWnd);
  458. END About;
  459.  
  460. PROCEDURE Disable;
  461. BEGIN;
  462. IF cx.ActivateCxObj(MyBrk,0)#0 THEN END;
  463. END Disable;
  464.  
  465. PROCEDURE Enable;
  466. BEGIN;
  467. IF cx.ActivateCxObj(MyBrk,1)#0 THEN END;
  468. END Enable;
  469.  
  470. PROCEDURE Reset;
  471. BEGIN;
  472. Math:=TRUE;Graph:=TRUE;
  473. MEmu:=0;GEmu:=0;
  474. MFac:=100;GFac:=100;
  475. Refresh(TRUE);
  476. END Reset;
  477.  
  478. PROCEDURE Init():BOOLEAN;
  479. VAR ret:BOOLEAN;
  480. BEGIN;
  481. IF e.OpenLibrary("bullet.library",0)#NIL THEN END;
  482. IF e.OpenLibrary("locale.library",0)#NIL THEN END;
  483. IF e.OpenLibrary("powerpacker.library",0)#NIL THEN END;
  484. IF e.OpenLibrary("lowlevel.library",0)#NIL THEN END;
  485. IF e.OpenLibrary("arp.library",0)#NIL THEN END;
  486. IF e.OpenLibrary("mathtrans.library",0)#NIL THEN END;
  487. IF e.OpenLibrary("rexxarplib.library",0)#NIL THEN END;
  488. IF e.OpenLibrary("gadtools.library",0)#NIL THEN END;
  489. IF e.OpenLibrary("rexxapp.library",0)#NIL THEN END;
  490. IF e.OpenLibrary("gadtools13.library",0)#NIL THEN END;
  491. IF e.OpenLibrary("rexxsupport.library",0)#NIL THEN END;
  492. IF e.OpenLibrary("asl.library",0)#NIL THEN END;
  493. IF e.OpenLibrary("reqchange.library",0)#NIL THEN END;
  494. IF e.OpenLibrary("iffparse.library",0)#NIL THEN END;
  495. IF e.OpenLibrary("conhandler.library",0)#NIL THEN END;
  496. IF e.OpenLibrary("iff.library",0)#NIL THEN END;
  497. IF e.OpenLibrary("rct.library",0)#NIL THEN END;
  498. IF e.OpenLibrary("oberonsupport.librarynw",0)#NIL THEN END;
  499. IF e.OpenLibrary("nonvolatile.library",0)#NIL THEN END;
  500. IF e.OpenLibrary("amigaguide.library",0)#NIL THEN END;
  501. IF e.OpenLibrary("voice.library",0)#NIL THEN END;
  502. IF e.OpenLibrary("decrunch.library",0)#NIL THEN END;
  503. IF e.OpenLibrary("reqtools.library",0)#NIL THEN END;
  504. IF e.OpenLibrary("parm.library",0)#NIL THEN END;
  505. IF e.OpenLibrary("muimaster.library",0)#NIL THEN END;
  506. IF e.OpenLibrary("diskfont.library36.x",0)#NIL THEN END;
  507. IF e.OpenLibrary("ixemul.library",0)#NIL THEN END;
  508. IF e.OpenLibrary("rexxmathlib.library",0)#NIL THEN END;
  509. IF e.OpenLibrary("translator.library",0)#NIL THEN END;
  510. IF e.OpenLibrary("rexxreqtools.library",0)#NIL THEN END;
  511. IF e.OpenLibrary("requester.library",0)#NIL THEN END;
  512. IF e.OpenLibrary("rexxhost.library",0)#NIL THEN END;
  513. IF e.OpenLibrary("rexxsyslib.library",0)#NIL THEN END;
  514. IF e.OpenLibrary("asl13.library",0)#NIL THEN END;
  515. IF e.OpenLibrary("mathieeedoubbas.library",0)#NIL THEN END;
  516. IF e.OpenLibrary("gadget.library",0)#NIL THEN END;
  517. IF e.OpenLibrary("explode.library",0)#NIL THEN END;
  518. IF e.OpenLibrary("version.library",0)#NIL THEN END;
  519. IF e.OpenLibrary("virusz.library",0)#NIL THEN END;
  520. IF e.OpenLibrary("downloader.library",0)#NIL THEN END;
  521. IF e.OpenLibrary("intuisup.library",0)#NIL THEN END;
  522. IF e.OpenLibrary("req.library",0)#NIL THEN END;
  523. IF e.OpenLibrary("datatypes.library",0)#NIL THEN END;
  524. IF e.OpenLibrary("multiuser.library.",0)#NIL THEN END;
  525. IF e.OpenLibrary("matrix.library",0)#NIL THEN END;
  526. ret:=TRUE;
  527. IF ret THEN
  528. FilNam:="ENVARC:Accel.prefs";
  529. MsPrt:=e.CreateMsgPort();
  530. IF MsPrt=NIL THEN ret:=FALSE;END;
  531. IF ret THEN
  532. NwBrk.version:=cx.nbVersion;
  533. NwBrk.name:=y.ADR("Accelerator");
  534. NwBrk.title:=y.ADR("The Amiga Accelerator V1.27 © ADI Inc ");
  535. NwBrk.descr:=y.ADR("The strongest software speedup ever.");
  536. NwBrk.unique:=SET{0,1};
  537. NwBrk.flags:=SET{cx.showHide};
  538. NwBrk.pri:=0;
  539. NwBrk.port:=MsPrt;
  540. NwBrk.reservedChannel:=0;
  541. MyBrk:=cx.CxBroker(NwBrk,Err);
  542. IF Err#0 THEN ret:=FALSE;END;
  543. IF ret THEN
  544. MyFil:=cx.CxFilter(y.ADR(CxKey));
  545. MySnd:=cx.CxSender(MsPrt,cx.cxmIEvent);
  546. MyTrs:=cx.CxTranslate(NIL);
  547. cx.AttachCxObj(MyBrk,MyFil);
  548. cx.AttachCxObj(MyFil,MySnd);
  549. cx.AttachCxObj(MyFil,MyTrs);
  550. IF cx.ActivateCxObj(MyBrk,1)#0 THEN ret:=FALSE;END;
  551. IF MyFil=NIL THEN ret:=FALSE;END;
  552. IF MySnd=NIL THEN ret:=FALSE;END;
  553. IF MyTrs=NIL THEN ret:=FALSE;END;
  554. IF cx.CxObjError(MyBrk)#LONGSET{} THEN ret:=FALSE;END;
  555. END;END;END;
  556. WinOp:=FALSE;
  557. IF ~ret THEN I.DisplayBeep(NIL);END;
  558. RETURN (ret);
  559. END Init;
  560.  
  561. PROCEDURE ShutDown;
  562. BEGIN;
  563. IF MyBrk#NIL THEN cx.DeleteCxObjAll(MyBrk);
  564. REPEAT;UNTIL e.GetMsg(MsPrt)=NIL;END;
  565. IF MsPrt#NIL THEN
  566. e.DeleteMsgPort(MsPrt);END;
  567. Hide;
  568. END ShutDown;
  569.  
  570. PROCEDURE CheckCx;
  571. BEGIN;
  572. IF MsPrt#NIL THEN
  573. REPEAT;
  574. eMsg:=e.GetMsg(MsPrt);
  575. IF eMsg#NIL THEN
  576. Msg:=y.VAL(cx.CxMsgPtr,eMsg);
  577. MsTp:=cx.CxMsgType(Msg);
  578. MsId:=cx.CxMsgID(Msg);
  579. e.ReplyMsg(eMsg);
  580.  IF MsTp=LONGSET{cx.cxmIEvent} THEN Show;END;
  581.  IF MsTp=LONGSET{cx.cxmCommand} THEN
  582.   IF MsId=cx.cmdDisable THEN Disable;END;
  583.   IF MsId=cx.cmdEnable THEN Enable;END;
  584.   IF MsId=cx.cmdAppear THEN Show;END;
  585.   IF MsId=cx.cmdDisappear THEN Hide;END;
  586.   IF MsId=cx.cmdKill THEN Quit:=TRUE;END;
  587.   IF MsId=cx.cmdUnique THEN Show;END;
  588.  END;
  589. END;
  590. UNTIL eMsg=NIL;
  591. END;
  592. END CheckCx;
  593.  
  594. VAR iAddress:e.APTR;
  595.     code:LONGINT;
  596.     class:LONGSET;
  597.     cyc:BOOLEAN;
  598.  
  599. BEGIN;
  600. IF Init() THEN
  601. GetToolTypes;
  602. LoadCon;
  603. IF CxPop THEN Show;END;
  604. REPEAT;
  605.  Signal:=LONGSET{MsPrt.sigBit};
  606. IF WinOp THEN
  607.  Signal:=LONGSET{MsPrt.sigBit,WinWnd.userPort.sigBit};END;
  608. IF e.Wait(Signal)#LONGSET{} THEN END;
  609. CheckCx;
  610. REPEAT;
  611. IF WinOp THEN
  612. ms:=gt.GetIMsg(WinWnd.userPort);
  613. IF ms#NIL THEN
  614.  cyc:=FALSE;
  615.  iAddress:=ms.iAddress;
  616.  code:=ms.code;
  617.  class:=ms.class;
  618.  IF I.closeWindow IN class THEN Hide;END;
  619.  IF (gt.checkBoxIDCMP = class)AND WinOp THEN
  620.   IF iAddress=WinGadgets[GDMathEn] THEN Math:=~Math;END;
  621.   IF iAddress=WinGadgets[GDGraphEn] THEN Graph:=~Graph;END;
  622.  END;
  623.  IF (I.menuPick IN class)AND WinOp THEN
  624.   IF code=-1856 THEN Quit:=TRUE;END;
  625.   IF code=-2048 THEN LoadConR;END;
  626.   IF code=-2016 THEN SaveConR;END;
  627.   IF code=-1952 THEN About;END;
  628.   IF code=-1888 THEN Hide;END;
  629.   IF code=-2047 THEN Reset;END;
  630.  END;
  631.  IF (gt.buttonIDCMP = class)AND WinOp THEN
  632.   IF iAddress=WinGadgets[GDSave] THEN SaveCon;END;
  633.   IF iAddress=WinGadgets[GDUse] THEN Hide;END;
  634.   IF iAddress=WinGadgets[GDCancel] THEN
  635.      Math:=oMath;Graph:=oGraph;
  636.      MFac:=oMFac;GFac:=oGFac;
  637.      MEmu:=oMEmu;GEmu:=oGEmu;
  638.      Hide;END;
  639.  END;
  640.  IF (iAddress=WinGadgets[GDMathAccel])AND WinOp THEN
  641.   MFac:=code;END;
  642.  IF (iAddress=WinGadgets[GDGraphAccel])AND WinOp THEN
  643.   GFac:=code;END;
  644.  IF (iAddress=WinGadgets[GDGraphEmu])AND WinOp THEN
  645.   GEmu:=code;cyc:=TRUE;
  646.    IF GEmu=8 THEN
  647.     IF e.OpenLibrary("fuckWindows.library",47)=NIL THEN
  648.      bol:=rq.RequestWin("Error opening library!",
  649.        "You need at least version 47.11\nof fuckWindows.library for\n"
  650.        "this graphics mode .",
  651.        "","Ok",WinWnd);
  652.     END;
  653.    END;
  654.   END;
  655.  IF (iAddress=WinGadgets[GDFPUType])AND WinOp THEN
  656.   MEmu:=code;cyc:=TRUE;END;
  657.  gt.ReplyIMsg(ms);
  658.  Refresh(cyc);
  659. END;
  660. END;
  661. UNTIL (ms=NIL) OR ~WinOp;
  662. UNTIL Quit;
  663. END;
  664. ShutDown;
  665. END Accel.
  666.